using System;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
using Apache.Cassandra;


namespace Cassandraemon
{


	public static class QueryableExtensions
	{

#region Common
		
		private static MethodInfo GetMethodInfo(MethodBase method, params Type[] genericType)
		{
			return (MethodInfo)method;
		}
		
		private static MethodInfo GetGenericMethodInfo(MethodBase method, params Type[] genericType)
		{
			return ((MethodInfo)method).MakeGenericMethod(genericType);
		}
		
		private static MethodCallExpression GetMethodCallExpression(MethodInfo method, params Expression[] expressions)
		{
			return Expression.Call(method, expressions);
		}
			
#endregion
		
#region CountColumn
		
		public static int CountColumn(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
		public static int CountColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<int>(expression);
		}
		
#endregion

#region CountColumn<TKey>
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
		public static Dictionary<TKey, int> CountColumn<TKey>(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetGenericMethodInfo(MethodBase.GetCurrentMethod(), typeof(TKey));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.Execute<Dictionary<TKey, int>>(expression);
		}
		
#endregion

#region FirstColumn
		
		public static IQueryable<CassandraEntity<Column>> FirstColumn(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> FirstColumn(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> FirstColumn(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> FirstColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<Column>> FirstColumn(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> FirstColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> FirstColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> FirstColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
#endregion

#region FirstOrDefaultColumn
		
		public static IQueryable<CassandraEntity<Column>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<Column>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> FirstOrDefaultColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
#endregion		

#region LastColumn

		public static IQueryable<CassandraEntity<Column>> LastColumn(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> LastColumn(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> LastColumn(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> LastColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<Column>> LastColumn(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> LastColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> LastColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> LastColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
#endregion
		
#region LastOrDefaultColumn
		
		public static IQueryable<CassandraEntity<Column>> LastOrDefaultColumn(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> LastOrDefaultColumn(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> LastOrDefaultColumn(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> LastOrDefaultColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<Column>> LastOrDefaultColumn(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> LastOrDefaultColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> LastOrDefaultColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> LastOrDefaultColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
#endregion
		
#region ReverseColumn
		
		public static IQueryable<CassandraEntity<Column>> ReverseColumn(this IQueryable<CassandraEntity<Column>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> ReverseColumn(this IQueryable<CassandraEntity<SuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> ReverseColumn(this IQueryable<CassandraEntity<CounterColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> ReverseColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<Column>>> ReverseColumn(this IQueryable<CassandraEntity<List<Column>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<List<Column>>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<SuperColumn>>> ReverseColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<List<SuperColumn>>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<CounterColumn>>> ReverseColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<List<CounterColumn>>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<CounterSuperColumn>>> ReverseColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression);
			
			return source.Provider.CreateQuery<CassandraEntity<List<CounterSuperColumn>>>(expression);
		}
		
#endregion
		
#region TakeColumn
		
		public static IQueryable<CassandraEntity<Column>> TakeColumn(this IQueryable<CassandraEntity<Column>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<Column>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<Column>>(expression);
		}
		
		public static IQueryable<CassandraEntity<SuperColumn>> TakeColumn(this IQueryable<CassandraEntity<SuperColumn>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<SuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<SuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterColumn>> TakeColumn(this IQueryable<CassandraEntity<CounterColumn>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterColumn>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<CounterColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<CounterSuperColumn>> TakeColumn(this IQueryable<CassandraEntity<CounterSuperColumn>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<CounterSuperColumn>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<CounterSuperColumn>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<Column>>> TakeColumn(this IQueryable<CassandraEntity<List<Column>>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<Column>>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<List<Column>>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<SuperColumn>>> TakeColumn(this IQueryable<CassandraEntity<List<SuperColumn>>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<SuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<List<SuperColumn>>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<CounterColumn>>> TakeColumn(this IQueryable<CassandraEntity<List<CounterColumn>>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<List<CounterColumn>>>(expression);
		}
		
		public static IQueryable<CassandraEntity<List<CounterSuperColumn>>> TakeColumn(this IQueryable<CassandraEntity<List<CounterSuperColumn>>> source, int count)
		{
			var method = GetMethodInfo(MethodBase.GetCurrentMethod(), typeof(CassandraEntity<List<CounterSuperColumn>>));
			var expression = GetMethodCallExpression(method, source.Expression, Expression.Constant(count));
			
			return source.Provider.CreateQuery<CassandraEntity<List<CounterSuperColumn>>>(expression);
		}
		
#endregion
		
	}
}
